using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Threading;
using System.Text;
using System.Windows.Forms;
using Chat.Util;

namespace Chat.Client
{
    public partial class LoginForm : Form
    {
        public LoginForm()
        {
            InitializeComponent();
        }

        private void Login_Load(object sender, EventArgs e)
        {
            this.tbServerIP.Text = Tools.GetLocalIP().ToString();
            this.tbUserName.Text = "dream";
           
        }

        private void btnLogin_Click(object sender, EventArgs e)
        {
            showMainForm();
            this.Hide();
        }

        public void showMainForm()
        {
            string strIp = this.tbServerIP.Text;
            string name = this.tbUserName.Text;

            MainForm mf = new MainForm(this);

            mf.Show();
            mf.init(this, name, strIp);
        }

        private void btnClose_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        public void close()
        {
            this.Close();
        }
       
    }
}